<template>
  <div class="enterpost_container">
    <div class="top">
           
      <!-- 查询栏左侧 -->
           
      <div
        class="top-left"
        style="
          position: relative;
          left:-30px;
          top:5px;
          float: left;
          width: 88%;
          font-size:15px;
          display: flex;
          justify-content: space-around;
/*           align-items: center; */
          line-height: 60px;
        "
      >
                姓名：        
        <el-input size="mini" v-model="input1" style="width: 100px"> </el-input>
                岗位：        
        <el-input size="mini" v-model="input2" style="width: 100px"> </el-input>
                用工性质：        
        <el-input size="mini" v-model="input3" style="width: 100px"> </el-input>
                入职时间：        
        <el-date-picker
          v-model="value1"
          type="daterange"
          size="mini"
          style="width: 180px"
          range-separator="——"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        >
                 
        </el-date-picker>
               户籍地：        
        <el-input size="mini" v-model="input4" style="width: 100px"> </el-input>
               学历：        
        <el-input size="mini" v-model="input5" style="width: 100px"> </el-input>
             
      </div>
           
      <!-- 查询栏右侧 -->
           
      <div
        class="top-right"
        style="
          position: relative;
          top:-8px;
          float: right;
          display: flex;
          justify-content: space-around;
          align-items: center;
          width: 12%;
        "
      >
               
        <el-row style="position: absolute; top: 12px">
                    <el-button type="primary" size="small">查询</el-button>    
                <el-button type="primary" size="small">上传</el-button>        
            <el-button type="primary" size="small">下载</el-button>        
        </el-row>
             
      </div>
         
    </div>
    <div class="container_main">
      <el-table
        :data="tableData"
        border
        header-align="center"
        style="width: 100%"
      >
        <el-table-column prop="empId" label="序号" width="50px">
        </el-table-column>
        <el-table-column prop="empName" label="姓名" width="100">
        </el-table-column>
        <el-table-column prop="empJob" label="岗位" width="100">
        </el-table-column>
        <el-table-column prop="empJobLevel" label="所在项目" width="100">
        </el-table-column>
        <el-table-column prop="empSex" label="性别" width="100">
        </el-table-column>
        <el-table-column prop="empSexempBirthday" label="户籍地" width="100">
        </el-table-column>
        <el-table-column prop="empDegree" label="学历" width="100">
        </el-table-column>
        <el-table-column prop="empHirDate" label="入职时间" width="100">
        </el-table-column>
        <el-table-column prop="empRegDate" label="转正时间" width="100">
        </el-table-column>
        <el-table-column prop="empRegDate" label="薪资(正式)" width="100">
        </el-table-column>
        <el-table-column prop="remarks1" label="人员性格分析" width="100">
        </el-table-column>
        <el-table-column label="操作" width="157">
          <template slot-scope="scope">
            <el-button size="mini" @click="dialogFormVisible = true"
              >编辑</el-button
            >

            <!-- 点击编辑弹出编辑详情页 -->
            <el-dialog
              title="修改员工信息"
              :visible.sync="dialogFormVisible"
              width="50%"
              center
            >
              <el-form :model="form">
                <el-form-item label="员工编号" label-width="120px">
                  <el-input
                    v-model="form.name"
                    style="width: 200px"
                    disabled
                  ></el-input>
                </el-form-item>
                <el-form-item label="岗位:">
                  <el-select
                    placeholder="请选择"
                    clearable
                    style="width: 200px; margin-left: 10px"
                  >
                    <el-option
                      v-for="(item, index) in job"
                      :key="index"
                      :label="item"
                      :value="item"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="用工性质:">
                  <el-select
                    
                    placeholder="请选择"
                    style="width: 200px; margin-left: 10px"
                  >
                    <el-option
                      v-for="(item, index) in employeeType"
                      :key="index"
                      :label="item"
                      :value="item"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="入职时间:">
                  <el-col :span="11">
                    <el-date-picker
                      type="date"
                      placeholder="选择日期"
                      
                      style="width: 200px"
                    >
                    </el-date-picker>
                  </el-col>
                </el-form-item>
                <el-form-item label="转正时间:">
                  <el-col :span="11">
                    <el-date-picker
                      type="date"
                      placeholder="选择日期"
                      
                      style="width: 200px"
                    >
                    </el-date-picker>
                  </el-col>
                </el-form-item>
                <el-form-item label="转正延顺:">
                  <el-col :span="11">
                    <el-date-picker
                      type="date"
                      placeholder="选择日期"
                      
                      style="width: 200px"
                    >
                    </el-date-picker>
                  </el-col>
                </el-form-item>
                <el-form-item label="离职时间:">
                  <el-col :span="11">
                    <el-date-picker
                      type="date"
                      placeholder="选择日期"
                      
                      style="width: 200px"
                    >
                    </el-date-picker>
                  </el-col>
                </el-form-item>
                <el-form-item label="备注1:" prop="desc">
                  <el-input
                    type="textarea"
                   
                    rows="1"
                    cols="35"
                    style="width: 200px; margin-left: 10px"
                  ></el-input>
                </el-form-item>
                <el-form-item label="备注2:" prop="desc">
                  <el-input
                    type="textarea"
                    
                    rows="1"
                    cols="35"
                    style="width: 200px; margin-left: 10px"
                  ></el-input>
                </el-form-item>
                <el-form-item label="备注3:" prop="desc">
                  <el-input
                    type="textarea"
                    
                    rows="1"
                    cols="35"
                    style="width: 200px; margin-left: 10px"
                  ></el-input>
                </el-form-item>
              </el-form>
              <div slot="footer" class="dialog-footer">
                <el-button @click="dialogFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="dialogFormVisible = false"
                  >确 定</el-button
                >
              </div>
            </el-dialog>

            <el-button
              size="mini"
              type="danger"
              @click="deleteData(scope.$index, scope.row)"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      dialogFormVisible: false, //编辑按钮
      input1: "",
      input2: "",
      input3: "",
      input4: "",
      input5: "",
      value1: "",
      isShowDeleteDialog: false, //是否显示点击删除按钮之后的弹框
      isRow: "", //这里存储点击删除时，该按钮所处的行数

      // 编辑详情页信息
      form: {
        name: "",
        region: "",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: "",
      },

      tableData: [
        {
          empId: 1,
          seen: false,
          empStaNum: 1001,
          empName: "王小虎",
          empDept: "前端开发人员",
          empJob: "前端工程师",
          empJobLevel: "项目组长",
          empSex: "男",
          empSexempBirthday: "1999-11-08",
          empMarried: "否",
          empOrigo: "甘肃酒泉",
          empFamiAddress: "甘肃省敦煌市七里镇",
          empAccType: "农村",
          empIdCardNo: "62210319991108101X",
          empDegree: "本科",
          empCollege: "兰州工业学院",
          empColMajor: "软件工程",
          empType: "实习",
          empTel: "15258585588",
          empAddress: "山西省朔州市朔城区北旺庄街道,厚德园",
          empHirDate: "2022-8-17",
          empRegDate: "",
          empResTime: "",
          empEngLevel: "四级",
          empSpecial: "", //特长
          empProTitel: "", //职称
          empNation: "汉",
          empPolStatus: "中共党员",
          empSecId: "", //社保卡号
          empAccFundId: "", //公积金账号
          empBank: "",
          empBankCardId: "",
          empConcat: "",
          empIntTel: "",
          empRelationship: "",
          remarks1: "无",
          remarks2: "无",
          remarks3: "无",
          
        },
        {
          empId: 2,
          seen: false,
          empName: "王小虎",
          empJob: "前端工程师",
          empDept: "朗驰管理系统",
          sex: "男",
          empFamiAddress: "山西省朔州市朔城区清水湾金宇李香山",
          empDegree: "本科",
          employment: "试用期",
          empHirDate: "2022-10-22",
          empSal: "3500-6500",
          empPerAna: "性格开朗，勤奋好学，努力上进，艰苦奋斗，勇于创新",
        },
        {
          empId: 3,
          seen: false,
          empName: "王小虎",
          empJob: "前端工程师",
          empDept: "朗驰管理系统",
          sex: "男",
          empFamiAddress: "山西省朔州市朔城区清水湾金宇李香山",
          empDegree: "本科",
          employment: "试用期",
          empHirDate: "2022-10-22",
          empSal: "3500-6500",
          empPerAna: "性格开朗，勤奋好学，努力上进，艰苦奋斗，勇于创新",
        },
        {
          empId: 4,
          seen: false,
          empName: "王小虎",
          empJob: "前端工程师",
          empDept: "朗驰管理系统",
          sex: "男",
          empFamiAddress: "山西省朔州市朔城区清水湾金宇李香山",
          empDegree: "本科",
          employment: "试用期",
          empHirDate: "2022-10-22",
          empSal: "3500-6500",
          empPerAna: "性格开朗，勤奋好学，努力上进，艰苦奋斗，勇于创新",
        },
        {
          empId: 5,
          seen: false,
          empName: "王小虎",
          empJob: "前端工程师",
          empDept: "朗驰管理系统",
          sex: "男",
          empFamiAddress: "山西省朔州市朔城区清水湾金宇李香山",
          empDegree: "本科",
          employment: "试用期",
          empHirDate: "2022-10-22",
          empSal: "3500-6500",
          empPerAna: "性格开朗，勤奋好学，努力上进，艰苦奋斗，勇于创新",
        },
      ],
    };
  },
  methods: {
    handleEdit($index, row) {},
    deleteData(row, $index) {
      this.isShowDeleteDialog = !this.isShowDeleteDialog;
      this.isRow = row.num;
    },
    //然后点击确认删除，首先把点击删除按钮后显示的弹框去掉，然后遍历判断，重新赋值实现删除功能
    confirmDeletion() {
      this.isShowDeleteDialog = !this.isShowDeleteDialog;
      // console.log(allow)
      let allow = this.allocationData.filter((item) => {
        if (item.num !== this.isRow) {
          return item;
        }
      });
      this.allocationData = allow;
    },
  },
};
</script>

<style lang="less" scoped>
.enterpost_container {
  background-color: #fff;
  height: 88.8vh;
  .top {
    height: 7%;
    font-size: 16px;
    background-color: #fff;
  }
  .container_main {
    height: 93%;
    background-color: #fff;
  }
}
</style>